//
//  YXNoticeHeaderView.m
//  CreditCard
//
//  Created by 杨旭 on 2018/1/22.
//  Copyright © 2018年 杨旭. All rights reserved.
//

#import "YXNoticeHeaderView.h"


@implementation YXNoticeHeaderView

- (UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [UILabel setLabelWithText:@"报备商户" fontSize:18 color:[UIColor blackColor]];
    }
    return _titleLab;
}

- (UILabel *)timeLab {
    if (!_timeLab) {
        _timeLab = [UILabel setLabelWithText:@"" fontSize:14 color:color_textThree];
    }
    return _timeLab;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = color_lineColor;
    }
    return _lineView;
}

- (UILabel *)contentLab {
    if (!_contentLab) {
        _contentLab = [UILabel setLabelWithText:@"" fontSize:15 color:color_textThree];
        _contentLab.numberOfLines = 0;
    }
    return _contentLab;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.titleLab];
        [self addSubview:self.timeLab];
        [self addSubview:self.lineView];
        [self addSubview:self.contentLab];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    YXWeakSelf
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.mas_left).offset(15);
        make.top.equalTo(weakSelf.mas_top).offset(13);
        [_titleLab sizeToFit];
    }];
    
    [_timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.titleLab.mas_right).offset(10);
        make.centerY.equalTo(weakSelf.titleLab.mas_centerY);
        [_timeLab sizeToFit];
    }];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.titleLab.mas_bottom).offset(13);
        make.left.equalTo(weakSelf.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(kScreenWidth, 1));
    }];
    
    [_contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.mas_left).offset(15);
        make.top.equalTo(weakSelf.lineView.mas_bottom).offset(13);
        make.right.equalTo(weakSelf.mas_right).offset(-15);
        [_contentLab sizeToFit];
    }];
}

@end
